//
//  ST_EditGeneralInfoCellModel.swift
//  btvideo
//
//  Created by mac on 2020/1/8.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SwifterSwift
import HandyJSON
import SwiftyAttributes


class ST_EditGeneralInfoCellModel: NSObject {
    
    var selectedId = ""
    
    var modifyKey = ""
    
    var displayKey = ""
    
    var displayValue = ""
    
    var cellHeight = 44.cgFloat
    
    
//   MARK:  display Value
    var displayValueAttribute:NSAttributedString?
    
    var reminderString = ""
}


extension ST_EditGeneralInfoCellModel{
    
    func create_display_attribute_string(){
        

        if displayValue.isEmpty{
            if modifyKey == "sign"{
                reminderString = "立即填写签名"
                cellHeight = 122
            }else if modifyKey == "personal_desc"{
                reminderString = "立即填写个人简介"
                cellHeight = 142
            }
            return
        }
            
        let paragraph = NSMutableParagraphStyle()
        
        paragraph.lineSpacing = 10
        
            let attrString = NSMutableAttributedString(string: displayValue)
            
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.38, green: 0.4, blue: 0.44, alpha: 1),.paragraphStyle:paragraph]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
            
        displayValueAttribute = attrString
        
        let attrHeight = attrString.height(withConstrainedWidth: ScreenWidth - 16-15)
        
        cellHeight = attrHeight + 17 + 4
//        }
        
    }
    
}
